package com.codedancer.campus.enums;

import cn.hutool.core.util.ObjectUtil;
import com.codedancer.campus.common.enums.CodeDbEnum;
import com.fasterxml.jackson.annotation.JsonValue;

/**
 * @Author codeworld 系统消息类型
 **/
public enum SystemMessageType implements CodeDbEnum {

    LOST_FOUND_ITEM_EXAMINE(1, "失物招领审核"),
    COMMODITY_EXAMINE(2, "商品审核"),
    FOLLOW_USER(3, "用户关注"),
    COMMODITY_OFF(4, "商品下架"),
    CIRCLE_EXAMINE(5, "圈子审核"),
    DYNAMIC_EXAMINE(6, "动态审核"),
    DYNAMIC_PUBLISH(7, "动态发布"),
    COMMODITY_PUBLISH(8, "商品发布"),
    CONFESSIONAL_WALL_PUBLISH(9, "表白墙发布"),
    LOST_FOUND_ITEM_PUBLISH(10, "失物招领发布"),
    COMMENT_REPORT(11, "评论举报"),
    RESET_PASSWORD(12, "重置密码");

    /**
     * 对应的值
     */
    @JsonValue
    private final Integer value;

    /**
     * 对应的名称
     */
    private final String name;

    SystemMessageType(Integer value, String name) {
        this.value = value;
        this.name = name;
    }

    public static SystemMessageType fromValue(Integer value) {
        for (SystemMessageType systemMessageType : SystemMessageType.values()) {
            if (ObjectUtil.equal(systemMessageType.getValue(), value)) {
                return systemMessageType;
            }
        }
        return null;
    }

    @Override
    public Integer getValue() {
        return value;
    }

    public String getName() {
        return name;
    }
}
